<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/commons/taglibs.jsp"%>
<%@ include file="/static/commons/meta.jsp"%>
<%@ include file="/static/commons/jquery-easyui.jsp"%>
<html >
	 <head>
 		<title>${title }</title>
 		 <link rel="stylesheet" href="${ctx }/static/styles/basic/basic.css" />
		 <link rel="stylesheet" href="${ctx }/static/styles/frame/main.css" />
		 <link rel="stylesheet" href="${ctx }/static/styles/frame/searchBtn.css" />
		 <link rel="stylesheet" href="${ctx }/static/styles/frame/searchCondition.css" />
	    <!-- js -->
 		<script language="JavaScript" src="${ctx}/static/scripts/check_all.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/set_select.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/waiting.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/crud.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/util.js"></script>
 		<script language="javascript"src="${ctx}/static/scripts/WdatePicker/WdatePicker.js"></script>
		
	</head>
  <body onload="init()">
		<form action="${ctx}/notice/list" method="post">
  			<input type="hidden" name="RequestVerificationToken" value="${RequestVerificationToken}" />
			<div class="width_100 group_box">
				<div class="group_search width_100">
					<vvise:searchInput id="noticeTitle" name="p_noticeTitle" displayText="标题" />
					<vvise:searchInput id="startDate" name="p_startDate" defVal="${startDate}" 
			                endId="endtDate" endName="p_endtDate" endDefVal="${endDate}"
			                 type="time2" displayText="通知日期" dateFormat="yyyy-MM-dd"/>
               	 	<div class="clear_both"></div>
				</div>
				<vvise:funMenu menuId="${menuId}" />
			</div>
        </form>
        <div class="listFrame">
        	<iframe name="listFrame" id="listFrame" frameBorder="0"
				scrolling="auto" style="width: 100%;height:100%;"></iframe>
        </div>
	</body>
	<script type="text/javascript">
  		var headers = {};
		headers['__RequestVerificationToken'] = "${RequestVerificationToken}";
			//回车事件
		document.onkeydown = keyKistener;
		function keyKistener(e){
			e = e ? e:event;
			if(e.keyCode == 13){
				try{
					search();
				}catch(e){}
			}
		}
		function init(){
			set_iframe_h();
			$(window).resize(function(){
				set_iframe_h();
			});
			search();
			$('.easyui-combobox').combobox();
		}
		//设置ifream 高度
		function set_iframe_h(){
			var win_height  = $(window).height();
			var func_line_h = $('.group_box').outerHeight(true);
			var list_height = win_height - func_line_h;
			$('.listFrame').css('height',list_height-10);
		}
		function search(){
			waiting();
			document.forms[0].target = "listFrame";
			document.forms[0].submit();
		}
		
		function create(noticeId){
			if(parent.isEmpty(noticeId))
				noticeId = "";
				
			var pp = parent;
			doCreate("通知公告",pp.width2,380,"${ctx}/notice/edit?noticeId="+noticeId);
		}
		
		function save(){
			var pp = parent;
			var editFrame = pp.winFrame;
			var noticeId = editFrame.$('#noticeId').val();
			var noticeDesc = editFrame.$('#noticeDesc').val();
			var noticeUser = editFrame.$('#noticeUser').val();
			
			if(!pp.validData("noticeTitle","请输入通知标题！"))
				return;
			
			if(!pp.validData("noticeDesc","请输入通知内容！"))
				return;
			
			if(noticeDesc.length > 250){
				pp.$.messager.alert('操作提示','通知内容不大于250个字','warning');
				return;
			}
			
			if(noticeUser == 2){
				if(editFrame.$('input[name="userId"]:checked').length == 0){
					pp.$.messager.alert('操作提示','请选择通知人员','warning');
					return;
				}
			}					
			doSave("${ctx}/notice/save",noticeId);
		}
		
		function view(noticeId){
			var pp = parent;
			doView("通知公告",pp.width2,380,"${ctx}/notice/edit?noticeId="+noticeId+"&view=view");
		}
		
		function removeF(){
			var pp = parent;
			var ids = "";
			var ecForm = listFrame.document.all.ec;
			if(!checkSelect(ecForm.id,true))
				return;
			ids = get_checkbox_values(ecForm.id,',');
			
			pp.confirmMsg("确定要删除吗？",function(){
				var urls = "${ctx}/notice/delete";
			    var params = "noticeIds="+ids;
			    executeAjax(urls,params,function(data){
				    if(data != 'error'){
				    	pp.$.messager.alert('操作提示', "操作成功！", "info",function(){
				    		listRefresh();
				    	});
					}else{
						pp.$.messager.alert('操作提示',"操作失败！","error");
					}
			    });
			});
	}
		</script>
</html>